package com.itheima.myException;

public class Demo1 {
    public static void main(String[] args) {
        method();
    }

    private static void method() {
        int[] arr=new int[3];
        System.out.println(arr[0]);
        try{
            //throws Exception数组越界问题--->编译时未报错运行时错误RunTimeException,可选择抛出,(意思是:谁调用传给谁,)
            //也可以用throws Exception的
            System.out.println(arr[3]);

        }catch (ArrayIndexOutOfBoundsException e){
            System.out.println("抓捕归案");
        }

    }
    private static void method2(){

    }
}
